home *** CD-ROM | disk | FTP | other *** search
- unit XDesktopImpl;
-
- interface
-
- uses
- Windows, ActiveX, Classes, Controls, Graphics, Menus, Forms, StdCtrls,
- ComServ, StdVCL, AXCtrls, AxDesktop_TLB, Desktop, DeskProp;
-
- type
- TXDesktop = class(TActiveXControl, IXDesktop)
- private
- { Private declarations }
- FDelphiControl: TDesktop;
- FEvents: IXDesktopEvents;
- protected
- { Protected declarations }
- procedure InitializeControl; override;
- procedure EventSinkChanged(const EventSink: IUnknown); override;
- procedure DefinePropertyPages(DefinePropertyPage: TDefinePropertyPage); override;
- function Get_Font: Font; safecall;
- function Get_ItemCount: Integer; safecall;
- function Get_TextBackgroundColor: TColor; safecall;
- function Get_TextColor: TColor; safecall;
- procedure AboutBox; safecall;
- procedure Set_Font(const Value: Font); safecall;
- procedure Set_ItemCount(Value: Integer); safecall;
- procedure Set_TextBackgroundColor(Value: TColor); safecall;
- procedure Set_TextColor(Value: TColor); safecall;
- function Get_Visible: WordBool; safecall;
- procedure Set_Visible(Value: WordBool); safecall;
- end;
-
- implementation
-
- uses SysUtils, About1;
-
- { TXDesktop }
-
- procedure TXDesktop.InitializeControl;
- begin
- FDelphiControl := Control as TDesktop;
- FDelphiControl.Visible := False;
- end;
-
- procedure TXDesktop.EventSinkChanged(const EventSink: IUnknown);
- begin
- FEvents := EventSink as IXDesktopEvents;
- end;
-
- procedure TXDesktop.DefinePropertyPages(DefinePropertyPage: TDefinePropertyPage);
- begin
- DefinePropertyPage (Class_DesktopProp);
- end;
-
- function TXDesktop.Get_Font: Font;
- begin
- GetOleFont(FDelphiControl.Font, Result);
- end;
-
- function TXDesktop.Get_ItemCount: Integer;
- begin
- Result := FDelphiControl.ItemCount;
- end;
-
- function TXDesktop.Get_TextBackgroundColor: TColor;
- begin
- Result := FDelphiControl.TextBackgroundColor;
- end;
-
- function TXDesktop.Get_TextColor: TColor;
- begin
- Result := FDelphiControl.TextColor;
- end;
-
- procedure TXDesktop.AboutBox;
- begin
- ShowXDesktopAbout;
- end;
-
- procedure TXDesktop.Set_Font(const Value: Font);
- begin
- SetOleFont(FDelphiControl.Font, Value);
- end;
-
- procedure TXDesktop.Set_ItemCount(Value: Integer);
- begin
- FDelphiControl.ItemCount := Value;
- end;
-
- procedure TXDesktop.Set_TextBackgroundColor(Value: TColor);
- begin
- FDelphiControl.TextBackgroundColor := Value;
- end;
-
- procedure TXDesktop.Set_TextColor(Value: TColor);
- begin
- FDelphiControl.TextColor := Value;
- end;
-
- function TXDesktop.Get_Visible: WordBool;
- begin
- Result := FDelphiControl.Visible;
- end;
-
- procedure TXDesktop.Set_Visible(Value: WordBool);
- begin
- FDelphiControl.Visible := Value;
- end;
-
- initialization
- TActiveXControlFactory.Create(
- ComServer,
- TXDesktop,
- TDesktop,
- Class_XDesktop,
- 1,
- '',
- 0);
- end.
-